package thread;

import java.util.PriorityQueue;
import java.util.Scanner;

public class demo6 {
    static class UmbrellaComb implements Comparable<UmbrellaComb> {
        int smallUmbrella;
        int largeUmbrella;

        UmbrellaComb(int smallUmbrella, int largeUmbrella) {
            this.smallUmbrella = smallUmbrella;
            this.largeUmbrella = largeUmbrella;
        }

        // 根据能承载的人数计算比较规则，人数少的排在前面（小根堆）
        @Override
        public int compareTo(UmbrellaComb o) {
            int thisCapacity = 2 * this.smallUmbrella + 3 * this.largeUmbrella;
            int otherCapacity = 2 * o.smallUmbrella + 3 * o.largeUmbrella;
            return thisCapacity - otherCapacity;
        }

        // 计算该伞的组合能带回的人数
        int getCapacity() {
            return 2 * smallUmbrella + 3 * largeUmbrella;
        }
    }

    public static int minTime(int C, int n, int m) {
        int remainPeople = C;
        int time = 0;
        PriorityQueue<UmbrellaComb> pq = new PriorityQueue<>();
        // 初始化所有可能的伞的组合放入优先队列（小根堆）
        for (int i = 0; i <= n; i++) {
            for (int j = 0; j <= m; j++) {
                if (2 * i + 3 * j > 0) {
                    pq.add(new UmbrellaComb(i, j));
                }
            }
        }
        while (remainPeople > 0) {
            // 取出当前能带回最多人的伞的组合
            UmbrellaComb umbrellaComb = pq.poll();
            int numBringBack = Math.min(remainPeople, umbrellaComb.getCapacity());
            remainPeople -= numBringBack;
            time += 2;  // 往返一次花费2小时
        }
        return time;
    }

    public static void main(String[] args) {
//        int C = 10;  // 食堂人数示例
//        int n = 2;  // 小伞数量示例
//        int m = 1;  // 大伞数量示例
        Scanner scanner = new Scanner(System.in);
        int C = scanner.nextInt();
        int n = scanner.nextInt();
        int m = scanner.nextInt();

        System.out.println(minTime(C, n, m));
    }
}
